﻿using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using SqliteApply.Addlication.SqliteW;
using SqliteApply.Common.Table;
using SqliteApply.Enum;

namespace SqliteApply.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class LoginController : ControllerBase
    {
        public readonly IMediator mediator;

        public LoginController(IMediator mediator)
        {
            this.mediator = mediator;
        }

        [HttpPost("LoginAdd")]
        public async Task<Result> Handle(UserCreateCommon request)
        {
            return await mediator.Send(request);
        }

        [HttpGet("LoginSearch")]
        public async Task<Result> Handle([FromQuery]LoginSearchCommon request)
        {
            return await mediator.Send(request);
        }
    }
}
